<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>销售退货管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="/resources/favicon.ico">
    <link rel="stylesheet" href="/resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<!--查询条件开始-->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;">
    <legend>查询条件</legend>
</fieldset>
<blockquote class="layui-elem-quote">
    <form action="/salesback/loadAllSales" method="post" id="dataForm" lay-filter="dataForm" class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">客户</label>
                <div class="layui-input-inline">
                    <select name="customerid" id="search_customerid">
                        <option value="0">请选择客户</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">商品名称</label>
                <div class="layui-input-inline">
                    <select name="goodsid" id="search_goodsid">
                        <option value="0">请选择商品</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="startTime" id="startTime" readonly  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">操作员</label>
                <div class="layui-input-inline">
                    <input type="text" name="operateperson" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-inline">
                    <input type="text" name="remark" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="endTime" id="endTime" readonly  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <div class="layui-inline">
                <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="doSearch"><span class="layui-icon layui-icon-search"></span>查询</button>
                <button type="reset" class="layui-btn layui-btn-warm"><span class="layui-icon layui-icon-refresh"></span>重置</button>

            </div>
        </div>
    </form>
</blockquote>
<!--查询条件结束-->
<!--数据表格开始-->
<div>
    <table class="layui-hide" id="salesbackTable" lay-filter="salesbackTable"></table>
</div>
<!--数据表格结束-->
<script type="text/javascript" src="/resources/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['jquery','form','table','layer','laydate'],function () {
        var $=layui.jquery;
        var form=layui.form;
        var table=layui.table;
        var layer=layui.layer;
        var laydate=layui.laydate;
        //初始化日期选择器
        laydate.render({
            elem:"#startTime",
            type:"datetime"
        });
        laydate.render({
            elem:"#endTime",
            type:"datetime"
        });
        //表格数据渲染
        var tableIns=table.render({
            elem: '#salesbackTable'
            ,url:'/salesback/loadAllSalesback'
            ,toolbar: '#salesbackToolBar' //开启头部工具栏，并为其绑定左侧模板
            ,title: '销售退货数据表'
            // ,height: 'full-200'
            ,page: true
            ,cols: [ [
                {field:'id', title:'ID',align: 'center'}
                ,{field:'customername', title:'客户',align: 'center'}
                ,{field:'goodsname', title:'商品名称',align: 'center'}
                ,{field:'size', title:'商品规格',align: 'center'}
                ,{field:'salesbacktime', title:'销售退货时间',align: 'center'}
                ,{field:'number', title:'销售退货数量',align: 'center'}
                ,{field:'salebackprice', title:'销售退货价格',align: 'center'}
                ,{field:'remark', title:'备注',align: 'center'}
                ,{field:'operateperson', title:'操作员',align: 'center'}
                ,{field:'paytype', title:'支付方式',align: 'center'}
            ] ]
        });
        //模糊查询
        form.on("submit(doSearch)",function (data) {
            tableIns.reload({
                where: data.field
                ,page: {
                    curr: 1
                }
            });
            return false;
        });
        //渲染查询条件的客户名称
        $.get("/customer/loadAllCustomerName",function (res) {
            var data=res.data;
            var html="<option value='0'>请选择客户</option>";
            var dom=$("#search_customerid");
            $.each(data,function(index,item){
                html+="<option value='"+item.id+"'>"+item.customername+"</option>"
            });
            dom.html(html);
            form.render("select");
        });
        //渲染查询条件的商品信息
        $.get("/goods/loadAllGoodsName",function (res) {
            var data=res.data;
            var html="<option value='0'>请选择商品</option>";
            var dom=$("#search_goodsid");
            $.each(data,function(index,item){
                html+="<option value='"+item.id+"'>"+item.goodsname+'-'+item.size+"["+item.customername+"]"+"</option>"
            });
            dom.html(html);
            form.render("select");
        });
    })
</script>
</body>
</html>